Home:ALL Converter>VSCode import "C" fails on modules

VSCode import "C" fails on modules

Ask Time:2019-10-22T21:22:50         Author:Ace

Json Formatter

Please see the following screenshot:

vscode with golang import "C" error

It says:

could not import C (no package data for import path C)

I have attached an example project that reproduces the failure, here: https://github.com/microsoft/vscode/files/3783446/example-project.zip

I am using Go 1.13 with the latest versions of each extension for Go and C/C++. There is no compiler error, and this is specifically seemingly isolated as a "vscode problem".

Is there a way to fix this vscode problem?

Author:Ace,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58505317/vscode-import-c-fails-on-modules
Ace :

This is a bug in gopls tool distributed in the official golang packages.\n\nHere are the issue links:\n\n\nhttps://github.com/golang/go/issues/32898\nhttps://go-review.googlesource.com/c/tools/+/202238/\n\n\n\n\ninfo from issue report:\n\ninternal/lsp: use Go/cgo source files instead of generated files\n\nUsing CompiledGoFiles was causing metadata lookups to fail for cgo\npackages because it includes generated files in the Go build cache\nwhen the built-in 'go list' driver is used. GoFiles includes both\nGo and cgo original file names, allowing metadata lookups to\nsucceed.\n\n\n",
2019-10-31T13:54:01
mourya venkat :

That's a bug with VSCode and I've written a medium article for this issue. \n\nhttps://medium.com/@mourya.g9/setting-up-confluent-kafka-client-for-golang-with-vscode-7a27bb94220b. Hope this helps.",
2019-10-28T18:21:21
yy